using UnityEngine;

public class AnimationTools : MonoBehaviour
{
	private Animator m_Animator;

	public string defaultAnimation;

	public int sceneIndex;

	public GameObject animationBegionReceiveObj;

	public GameObject animationEndReceiveObj;

	private void Awake()
	{
		m_Animator = GetComponent<Animator>();
	}

	public void Init()
	{
		m_Animator = GetComponent<Animator>();
	}

	private void Start()
	{
		if (!string.IsNullOrEmpty(defaultAnimation) && (bool)m_Animator)
		{
			UnityEngine.Debug.Log("defaultAniamtion:" + defaultAnimation);
			m_Animator.Play(defaultAnimation);
		}
	}

	public void ActiveFalse()
	{
		base.gameObject.SetActive(value: false);
	}

	public void ActiveObjectFalse(GameObject o)
	{
		o.SetActive(value: false);
	}

	public void DestroySelf()
	{
		UnityEngine.Object.Destroy(base.gameObject);
	}

	public void DestroyObject(GameObject o)
	{
		UnityEngine.Object.Destroy(o);
	}

	public void FadeParam(string param)
	{
		m_Animator.SetBool(param, value: false);
	}

	public void ActiveParam(string param)
	{
		m_Animator.SetBool(param, value: true);
	}

	public void Trigger(string param)
	{
		m_Animator.SetTrigger(param);
		if (param.Equals("ToMain"))
		{
			UnityEngine.Debug.Log("ToMain!");
			AdManagerOld.instance.curAd.HideBanner();
		}
	}

	public void LoadScene()
	{
		//if (!AdManager1.instance.ShieldAddress && sceneIndex == 2)
		//{
		//	CheckTouch.Show(delegate
		//	{
		//		StartLoadScene();
		//	});
		//}
		//else
		//{
			StartLoadScene();
		//}
	}

	private void StartLoadScene()
	{
		UnityEngine.SceneManagement.SceneManager.LoadScene(sceneIndex);
	}

	public void PlaySound(string clip)
	{
		AudioManager.PlayClip(clip, 1f);
	}

	public void OnAnimationBegion(string arg)
	{
		if (animationBegionReceiveObj != null)
		{
			UnityEngine.Debug.Log("OnAnimationBegion" + arg);
			animationBegionReceiveObj.SendMessage(arg);
		}
	}

	public void OnAnimationEnd(string arg)
	{
		if (animationEndReceiveObj != null)
		{
			UnityEngine.Debug.Log("OnAnimationEnd" + arg);
			if (arg.Equals("Hide"))
			{
				animationEndReceiveObj.SetActive(value: false);
			}
			else
			{
				animationEndReceiveObj.SendMessage(arg, null, SendMessageOptions.DontRequireReceiver);
			}
		}
	}
}
